const Router = require('koa-router');
const campus_announcement = new Router();
const bodyparser = require('koa-bodyparser');
const db = require('../utils/db');
campus_announcement.use(bodyparser());

campus_announcement.get('/', async (ctx) => {
    console.log('campus_announcement');
    let arr = await new Promise((res, rej) => {
        return db.query(`select * from notices`, (err, data) => {
            if (err) throw err
            console.log(data);
            res(data);
        })
    })
   ctx.body = arr;
})

module.exports = campus_announcement;